<template>
  <div class="newinfo-content">
    <h3 class="title">{{ newinfo.text }}</h3>
    <p class="subtitle">
      <span>发表时间:{{ newinfo.created_at }}</span>
      <span>点击:{{ newinfo.love }}次</span>
    </p>
    <hr />

    <div class="content"></div>
    <hr />
    <!-- 这个是comment.vue -->
    <com-box></com-box>
  </div>
</template>

<script>
import comment from "../components/subinfo/comment.vue";

export default {
  data() {
    return {
      id: this.$route.params.cai,
      newinfo: "",
    };
  },

  created() {
    console.log("哈哈");
    this.getnewinfo();
  },
  methods: {
    getnewinfo() {
      var ff = Math.floor(Math.random() * 10);
      this.$http.get("https://www.apiopen.top/satinApi").then((res) => {
        if (res.status === 200) {
          this.newinfo = res.body.data[ff];
        }
      });
    },
  },

  components: {
    "com-box": comment,
  },
};
</script>

<style lang="less" scoped>
.newinfo-content {
  padding: 0 4px;
  .title {
    font-size: 16px;
    text-align: center;
    color: red;
  }

  .subtitle {
    font-size: 13px;
    color: #226aff;
    display: flex;
    justify-content: space-between;
  }
}
</style>
